const fs = require('fs')

function delTextFromFile (filePath, text) {
    const fileText = fs.readFileSync(filePath, 'utf-8')
    console.log(fileText)
    if (!fileText) return
    const fileTextArr = fileText.split('\n')
    if (fileTextArr.includes(text)) {
        const index = fileTextArr.indexOf(text)
        fileTextArr.splice(index, 1)
    }
    const _text = fileTextArr.join('\n')
    fs.writeFileSync(filePath, _text)
}

delTextFromFile('currentDownload.txt', 'aa')